﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="products_edit.aspx.cs" Inherits="Donal.Xms.Web.qianyi.common.products_edit" ValidateRequest="false" %>

<%@ Import Namespace="Donal.Xms.Common" %>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>编辑产品管理</title>
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <link rel="stylesheet" type="text/css" href="../../scripts/artdialog/ui-dialog.css" />
    <link rel="stylesheet" type="text/css" href="../skin/icon/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../skin/default/style.css" />
    <script type="text/javascript" charset="utf-8" src="../../scripts/jquery/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../scripts/jquery/Validform_v5.3.2_min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../scripts/datepicker/WdatePicker.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../scripts/artdialog/dialog-plus-min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../scripts/webuploader/webuploader.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../editor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="../../editor/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="../../editor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/uploader.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/common.js"></script>
    <script type="text/javascript" charset="utf-8" src="../js/laymain.js"></script>
    <script type="text/javascript">
        $(function () {
            //初始化表单验证
            $("#form1").initValidform();

            //初始化编辑器
            $(".editor").each(function (i) {
                var objId = $(this).attr("id");
                if (objId != "undefined") {
                    var editor = UE.getEditor(objId, {
                        serverUrl: '../../../tools/upload_ajax.ashx',
                        initialFrameWidth: '100%',
                        initialFrameHeight: 350
                    });
                }
            });

            //初始化上传控件
            $(".upload-img").InitUploader({ filesize: "<%=sysConfig.imgsize %>", sendurl: "../../tools/upload_ajax.ashx", swf: "../../scripts/webuploader/uploader.swf", filetypes: "<%=sysConfig.fileextension %>" });
            $(".upload-video").InitUploader({ filesize: "<%=sysConfig.videosize %>", sendurl: "../../tools/upload_ajax.ashx", swf: "../../scripts/webuploader/uploader.swf", filetypes: "<%=sysConfig.videoextension %>" });
            $(".upload-album").InitUploader({ btntext: "批量上传", multiple: true, water: true, thumbnail: true, filesize: "<%=sysConfig.imgsize %>", sendurl: "../../tools/upload_ajax.ashx", swf: "../../scripts/webuploader/uploader.swf" });

            //设置封面图片的样式
            $(".photo-list ul li .img-box img").each(function () {
                if ($(this).attr("src") == $("#hidFocusPhoto").val()) {
                    $(this).parent().addClass("selected");
                }
            });

            //创建上传附件
            $(".attach-btn").click(function () {
                showAttachDialog();
            });

            //绑定品牌按钮
            $("#specAddButton").click(function () {
                var liObj = $("#item_box");
                var d = top.dialog({
                    id: 'specDialogId',
                    padding: 0,
                    title: "参数关联",
                    url: 'dialog/dialog_products_attribute.aspx'
                }).showModal();
                //将容器对象传进去
                d.data = liObj;
            });

        });

        //删除附件节点
        function delItemTr(obj) {
            $(obj).parent().parent().remove();
        }

        //初始化附件窗口
        function showAttachDialog(obj) {
            var objNum = arguments.length;
            var attachDialog = top.dialog({
                id: 'attachDialogId',
                title: "上传附件",
                url: 'dialog/dialog_article_attach.aspx',
                width: 500,
                height: 180,
                onclose: function () {
                    var liHtml = this.returnValue; //获取返回值
                    if (liHtml.length > 0) {
                        $("#showAttachList").children("ul").append(liHtml);
                    }
                }
            }).showModal();
            //如果是修改状态，将对象传进去
            if (objNum == 1) {
                attachDialog.data = obj;
            }
        }
        //删除附件节点
        function delAttachNode(obj) {
            $(obj).parent().remove();
        }

        function changeVale(obj) {             
            // 检查复选框是否被选中
            var isChecked = $(obj).is(':checked');            
            $(obj).siblings('input[name="hid_display"]').val(isChecked ? 0 : 1);
        }
 
    </script>
</head>

<body class="mainbody">
    <form id="form1" runat="server">
        <!--导航栏-->
        <div class="location">
            <a href="products_list.aspx" class="back"><i class="iconfont icon-up"></i><span>返回列表页</span></a>
            <a href="../center.aspx"><i class="iconfont icon-home"></i><span>首页</span></a>
            <i class="arrow iconfont icon-arrow-right"></i>
            <a href="products_list.aspx"><span>产品管理</span></a>
            <i class="arrow iconfont icon-arrow-right"></i>
            <span>编辑产品管理</span>
        </div>
        <div class="line10"></div>
        <!--/导航栏-->

        <!--产品管理-->
        <div id="floatHead" class="content-tab-wrap">
            <div class="content-tab">
                <div class="content-tab-ul-wrap">
                    <ul>
                        <li><a class="selected" href="javascript:;">基本信息</a></li>
                        <li><a href="javascript:;">产品参数</a></li>
                        <li><a href="javascript:;">详细描述</a></li>
                        <li><a href="javascript:;">SEO选项</a></li>
                    </ul>
                </div>
            </div>
        </div>

        <div class="tab-content">
            <dl>
                <dt>所属类别</dt>
                <dd>
                    <div class="rule-single-select">
                        <asp:DropDownList ID="ddlCategoryId" runat="server" datatype="*" sucmsg=" "></asp:DropDownList>
                    </div>
                </dd>
            </dl>
            <dl>
                <dt>是否上架</dt>
                <dd>
                    <div class="rule-single-checkbox">
                        <asp:CheckBox ID="cbStatus" runat="server" Checked="True" />
                    </div>
                    <span class="Validform_checktip">*不上架前台则无法显示</span>
                </dd>
            </dl>
            <dl>
                <dt>推荐属性</dt>
                <dd>
                    <div class="rule-multi-checkbox">
                        <asp:CheckBoxList ID="cblItem" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                            <asp:ListItem Value="1">置顶</asp:ListItem>
                            <asp:ListItem Value="1">推荐</asp:ListItem>
                            <asp:ListItem Value="1">热门</asp:ListItem>
                        </asp:CheckBoxList>
                    </div>
                </dd>
            </dl>
            <dl>
                <dt>属性标题</dt>
                <dd>
                    <asp:TextBox ID="txtTitle" runat="server" CssClass="input normal" datatype="*2-100" sucmsg=" " />
                    <span class="Validform_checktip">*标题最多100个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>副标题</dt>
                <dd>
                    <asp:TextBox ID="txtSub_title" runat="server" CssClass="input normal" datatype="*0-255" sucmsg=" " />
                    <asp:Label ID="txtSub_title_tip" runat="server" CssClass="Validform_checktip" />
                </dd>
            </dl>
            <dl>
                <dt>封面图片</dt>
                <dd>
                    <asp:TextBox ID="txtImgUrl" runat="server" CssClass="input normal upload-path" />
                    <div class="upload-box upload-img"></div>
                </dd>
            </dl>
            <dl>
                <dt>排序数字</dt>
                <dd>
                    <asp:TextBox ID="txtSortId" runat="server" CssClass="input small" datatype="n" sucmsg=" ">99</asp:TextBox>
                    <span class="Validform_checktip">*数字，越小越向前</span>
                </dd>
            </dl>
            <dl>
                <dt>发布时间</dt>
                <dd>
                    <asp:TextBox ID="txtAddTime" runat="server" CssClass="input rule-date-input" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" datatype="/^\s*$|^\d{4}\-\d{1,2}\-\d{1,2}\s{1}(\d{1,2}:){2}\d{1,2}$/" errormsg="请选择正确的日期" sucmsg=" " />
                    <span class="Validform_checktip">不选择默认当前发布时间</span>
                </dd>
            </dl>
            <dl>
                <dt>图片相册</dt>
                <dd>
                    <div class="upload-box upload-album"></div>
                    <input type="hidden" name="hidFocusPhoto" id="hidFocusPhoto" runat="server" class="focus-photo" />
                    <div class="photo-list">
                        <ul>
                            <asp:Repeater ID="rptAlbumList" runat="server">
                                <ItemTemplate>
                                    <li>
                                        <input type="hidden" name="hid_photo_name" value="<%#Eval("id")%>|<%#Eval("original_path")%>|<%#Eval("thumb_path")%>" />
                                        <input type="hidden" name="hid_photo_remark" value="<%#Eval("remark")%>" />
                                        <div class="img-box" onclick="setFocusImg(this);">
                                            <img src="<%#Eval("thumb_path")%>" bigsrc="<%#Eval("original_path")%>" />
                                            <span class="remark"><i><%#Eval("remark").ToString() == "" ? "暂无描述..." : Eval("remark").ToString()%></i></span>
                                        </div>
                                        <a href="javascript:;" onclick="setRemark(this);">描述</a>
                                        <a href="javascript:;" onclick="delImg(this);">删除</a>
                                    </li>
                                </ItemTemplate>
                            </asp:Repeater>
                        </ul>
                    </div>
                </dd>
            </dl>
            <dl>
                <dt>上传附件</dt>
                <dd>
                    <a class="icon-btn attach-btn"><i class="iconfont icon-add"></i><span>添加附件</span></a>
                    <div id="showAttachList" class="attach-list">
                        <ul>
                            <asp:Repeater ID="rptAttachList" runat="server">
                                <ItemTemplate>
                                    <li>
                                        <input name="hid_attach_id" type="hidden" value="<%#Eval("id")%>" />
                                        <input name="hid_attach_filename" type="hidden" value="<%#Eval("file_name")%>" />
                                        <input name="hid_attach_filepath" type="hidden" value="<%#Eval("file_path")%>" />
                                        <input name="hid_attach_filesize" type="hidden" value="<%#Eval("file_size")%>" />
                                        <i class="iconfont icon-attachment"></i>
                                        <a href="javascript:;" onclick="delAttachNode(this);" class="del" title="删除附件"><i class="iconfont icon-remove"></i></a>
                                        <a href="javascript:;" onclick="showAttachDialog(this);" class="edit" title="更新附件"><i class="iconfont icon-pencil"></i></a>
                                        <div class="title"><%#Eval("file_name")%></div>
                                        <div class="info">类型：<span class="ext"><%#Eval("file_ext")%></span> 大小：<span class="size"><%#Convert.ToInt32(Eval("file_size")) > 1024 ? Convert.ToDouble((Convert.ToDouble(Eval("file_size")) / 1024f)).ToString("0.0") + "MB" : Eval("file_size") + "KB"%></span> 下载：<span class="down"><%#Eval("down_num")%></span>次</div>

                                    </li>
                                </ItemTemplate>
                            </asp:Repeater>
                        </ul>
                    </div>
                </dd>
            </dl>
            <dl>
                <dt>参数选项</dt>
                <dd><a id="specAddButton" class="icon-btn"><i class="iconfont icon-add"></i><span>添加选项</span></a></dd>
            </dl>
            <dl>
                <dt></dt>
                <dd>
                    <div class="table-container">
                        <table border="0" cellspacing="0" cellpadding="0" class="border-table">
                            <thead>
                                <tr>
                                    <th width="10%">名称</th>
                                    <th width="10%">筛选</th>
                                    <th width="10%">排序</th>
                                    <th width="10%">操作</th>
                                </tr>
                            </thead>
                            <tbody id="item_box">
                                <asp:Repeater ID="rptAttributeList" runat="server">
                                    <ItemTemplate>
                                        <tr class="td_c" id="tr_<%#Eval("id")%>">
                                            <td>
                                                <input type="hidden" name="hid_id" id="hid_id" value="<%#Eval("id")%>" />
                                                <input type="hidden" name="hid_field_id" id="hid_field_id" value="<%#Eval("field_id")%>" />
                                                <span class="item_title"><%#Eval("title")%></span>
                                            </td>
                                            <td>
                                                <input type="checkbox" name="cbDisplay" <%#Eval("display").ToString()=="0"?"checked=\"checked\"":""%>  onclick="changeVale(this);" />
                                                <input type="hidden" name="hid_display" value="<%#Eval("display")%>" />
                                            </td>
                                            <td>
                                                <input type="number" class="input small" datatype="n" value="<%#Eval("sort_id")%>" name="sort_id" />
                                            </td>
                                            <td>
                                                <a title="删除" class="img-btn" onclick="delItemTr(this);"><i class="iconfont icon-delete"></i></a>
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </tbody>
                        </table>
                    </div>

                </dd>
            </dl>
        </div>

        <div class="tab-content" style="display: none">
            <dl>
                <dt>精度等级</dt>
                <dd>
                    <asp:TextBox ID="txtAccuracy_level" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">精度等级最多255个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>流体温度</dt>
                <dd>
                    <asp:TextBox ID="txtFluid_temperature" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">流体温度最多255个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>流场敏感度等级</dt>
                <dd>
                    <asp:TextBox ID="txtFlow_field_sensitivity_level" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">流场敏感度等级最多255个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>防护等级</dt>
                <dd>
                    <asp:TextBox ID="txtProtection_level" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">防护等级最多255个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>气候和机械环境安全</dt>
                <dd>
                    <asp:TextBox ID="txtClimate_and_mechanical_environmental_safety" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">气候和机械环境安全最多255个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>电磁兼容性等级</dt>
                <dd>
                    <asp:TextBox ID="txtElectromagnetic_compatibility_level" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">电磁兼容性等级最多255个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>功耗</dt>
                <dd>
                    <asp:TextBox ID="txtPower_waste" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">功耗最多255个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>输出信号</dt>
                <dd>
                    <asp:TextBox ID="txtOutput_signal" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">输出信号最多255个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>通信接口</dt>
                <dd>
                    <asp:TextBox ID="txtCommunication_interface" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">通信接口最多255个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>供电电源</dt>
                <dd>
                    <asp:TextBox ID="txtPower_supply" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">供电电源最多255个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>工作环境</dt>
                <dd>
                    <asp:TextBox ID="txtWork_environment" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">工作环境最多255个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>压力损失</dt>
                <dd>
                    <asp:TextBox ID="txtPressure_loss" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">压力损失最多255个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>数据存储</dt>
                <dd>
                    <asp:TextBox ID="txtData_storage" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">数据存储最多255个字符</span>
                </dd>
            </dl>
            <dl>
                <dt>执行标准</dt>
                <dd>
                    <asp:TextBox ID="txtExecution_standards" runat="server" CssClass="input normal" Width="200" datatype="*0-255" sucmsg=" " />
                    <span class="Validform_checktip">执行标准最多255个字符</span>
                </dd>
            </dl>
        </div>

        <div class="tab-content" style="display: none">
            <dl>
                <dt>调用别名</dt>
                <dd>
                    <asp:TextBox ID="txtCallIndex" runat="server" CssClass="input normal" datatype="/^\s*$|^[a-zA-Z0-9\-\_]{2,50}$/" sucmsg=" "></asp:TextBox>
                    <span class="Validform_checktip">*别名访问，非必填，不可重复</span>
                </dd>
            </dl>
            <dl>
                <dt>URL链接</dt>
                <dd>
                    <asp:TextBox ID="txtLinkUrl" runat="server" MaxLength="255" CssClass="input normal" />
                    <span class="Validform_checktip">填写后直接跳转到该网址</span>
                </dd>
            </dl>
            <dl>
                <dt>属性摘要</dt>
                <dd>
                    <asp:TextBox ID="txtAbstracts" runat="server" CssClass="input" TextMode="MultiLine" datatype="*0-255" sucmsg=" "></asp:TextBox>
                    <span class="Validform_checktip">不填写则自动截取产品管理前255字符</span>
                </dd>
            </dl>
            <dl>
                <dt>属性描述</dt>
                <dd>
                    <textarea id="txtContent" class="editor" runat="server"></textarea>
                </dd>
            </dl>
        </div>

        <div class="tab-content" style="display: none">
            <dl>
                <dt>SEO标题</dt>
                <dd>
                    <asp:TextBox ID="txtSeoTitle" runat="server" MaxLength="255" CssClass="input normal" datatype="*0-100" sucmsg=" " />
                    <span class="Validform_checktip">255个字符以内</span>
                </dd>
            </dl>
            <dl>
                <dt>SEO关健字</dt>
                <dd>
                    <asp:TextBox ID="txtSeoKeywords" runat="server" CssClass="input" TextMode="MultiLine" datatype="*0-255" sucmsg=" "></asp:TextBox>
                    <span class="Validform_checktip">以“,”逗号区分开，255个字符以内</span>
                </dd>
            </dl>
            <dl>
                <dt>SEO描述</dt>
                <dd>
                    <asp:TextBox ID="txtSeoDescription" runat="server" CssClass="input" TextMode="MultiLine" datatype="*0-255" sucmsg=" "></asp:TextBox>
                    <span class="Validform_checktip">255个字符以内</span>
                </dd>
            </dl>
        </div>
        <!--/产品管理-->

        <!--工具栏-->
        <div class="page-footer">
            <div class="btn-wrap">
                <asp:Button ID="btnSubmit" runat="server" Text="提交保存" CssClass="btn" OnClick="btnSubmit_Click" />
                <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript: history.back(-1);" />
            </div>
        </div>
        <!--/工具栏-->

    </form>
</body>
</html>

